# -*- coding: utf-8 -*-

#运算符重载
#部分运算符与类的专有方法对照表
#+     __add__()
#-     __sub__()
#*     __mul__()
#/    __div__()
#%    __mod__()
#**    __pow__()

class MyList:
    __mylist=[]
    def __init__(self,*args):
        self.__mylist=[]#初始化
        for arg in args:
            self.__mylist.append(arg)
    def __add__(self,n):
        for i in range(0,len(self.__mylist)):
            self.__mylist[i]=self.__mylist[i]+n
            
    def __sub__(self,n):
        for i in range(0,len(self.__mylist)):
            self.__mylist[i]=self.__mylist[i]+n
    #其余的运算符一样
    def __len__(self):#重载__len__()方法
        return len(self.__mylist)
    
    def show(self):#定义show方法
        print(self.__mylist)
            
#实例化对象
#a=MyList(1,2,3,4,5)
#a.show()
#
#a+5#调用__add__()方法
#a.show()